package main.collection;

import com.google.gson.Gson;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by ChengGM on 2016/12/20.
 */
public class ListToStringTest {
    static class Dog {
        private int age;

        public int getAge() {
            return age;
        }

        public void setAge(int age) {
            this.age = age;
        }
    }

    public static void main(String[] args) {
        List list1 = new ArrayList();
        List list2 = new ArrayList();
        List list3 = new ArrayList();
        List list4 = new ArrayList();
        Dog dog = new Dog();
        dog.setAge(12);

        list1.add(3);
        list1.add(dog);
        list2.add(4);
        list2.add(5);
        list3.add(list1);
        list3.add(list2);
        list4.addAll(list1);
        list4.addAll(list2);
        list4.addAll(list3);
        Gson gosn = new Gson();
        System.out.println(gosn.toJson(list1));
        System.out.println(gosn.toJson(list2));
        System.out.println(gosn.toJson(list3));
        System.out.println(gosn.toJson(list4));

    }
}
